package com.dyz.model;

import java.util.Formatter;
import java.util.GregorianCalendar;

public class AFaktura {

	private String number, companyName, adress, descr;
	private float kwotaVat;
	protected int vat;
	private static int licznik;
	private int numerFaktury;
	protected GregorianCalendar gc;
	private int d, m, y;

	/*
	 * public abstract float getVat() ; public abstract float getKwotaVat() ;
	 * public abstract float getKosztB(); public abstract float getKosztN();
	 * public abstract String getCompanyName() ;
	 */

	public String toString() {
		return String.format("%d.  %d-%d-%d  %s  %s  %s  %s  ", numerFaktury,
				d, m, y, number, companyName, adress, descr);
	}

	public String toFormatString() {

		return String.format("%6s. |%d-%d-%d| |%-20s| |%-20s| |%-40s| |%-20s| ",
				numerFaktury, d, m, y, number+".", companyName, adress, descr);

	}

	// cena netto, vat, kwotavat, cena brutto, dodatkowe
	public AFaktura(String number, String data, String companyName,
			String adress, String descr, int vat) {
		super();
		y = new Integer(data.substring(6, 10));
		m = new Integer(data.substring(3, 5));
		d = new Integer(data.substring(0, 2));

		// System.out.println(y+""+m+""+d);

		gc = new GregorianCalendar(y, m, d);
		this.number = number;
		this.adress = adress;
		this.descr = descr;
		this.companyName = companyName;
		this.vat = vat;
		numerFaktury = ++licznik;
	}

	public String getCompanyName() {
		return companyName;
	}

	public float getVat() {
		return vat;
	}

	public float getKwotaVat() {
		return kwotaVat;
	}

	public static float sumaSumarum() {
		return Przychod.getSumaBrutto() - Koszty.getSumaBrutto();
	}

}
